<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
</body>
</html>
<script>
	// var divArr = document.getElementsTagName("div");
	// console.log(divArr);
	// for (var i = 0;i < divArr.length; i++){
	// 	divArr[i].style.width = 500 - i * 50 + "px";
	// 	divArr[i].style.height = 500 - i *
	// }

	arr = [2, 3, 1, 5, 4]
	for (var i = 0; i < arr.length-1; i++){
		for(var j = 0; j < arr.length-1-i; j++){
			if(arr[j] > arr[j+1]){
				var temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j+1] = temp;
			}
		}
		
	}
	document.write(arr);
	// 内层控制每轮比较的次数
	for (var i = 0; i < arr.length - 1; i++) {
		for (var j = 0; j < arr.length - 1 - i; j++) {
			if (arr[j] > arr[j+1]) {
				var temp = arr[j];
				arr[j] = arr[j+1];
				arr[j+1] = temp;
			}
		}
	}
	console.log(arr);



	var liArr = document.getElementsTagName("li");
	var colorArry = ["red","orange","yellow","green","blue","cyan","purple"];
	var nameArr = ["j","k","u","k","o","p","h"];
	for(var i = 0; i < liArr.length; i++){
		var li = liArr[i];
	}


</script>